package com.salon.modules.makeup.controller;

import com.salon.common.http.response.ObjectResult;
import com.salon.common.http.response.PageResult;
import com.salon.modules.makeup.entity.ReservationEntity;
import com.salon.modules.makeup.service.ReservationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;


/**
 * 服务预约
 *
 * @author lch 12345678@qq.com
 * @since 1.0.0 2023-10-10
 */
@RestController
@RequestMapping("makeup/reservation")
@Api(tags="服务预约")
public class ReservationController {

    @Autowired
    private ReservationService reservationService;

    @GetMapping("/list")
    @ApiOperation("分页")
    @RequiresPermissions("makeup:reservation:select")
    public PageResult<ReservationEntity> list(@ApiIgnore @RequestParam Map<String, Object> params){
        return reservationService.listReservationByPage(params);
    }

    @GetMapping("/info/{id}")
    @ApiOperation("详情")
    @RequiresPermissions("makeup:reservation:select")
    public ObjectResult<ReservationEntity> getById(@PathVariable("id") Integer id){
        ReservationEntity data = reservationService.getReservationById(id);
        return ObjectResult.success(data);
    }

}